// pages/coach_photos/coach_photos.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    photos:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this
    console.log(options)
    wx.request({
      url: app.url + '/weiapp/api/getcoachphotos',
      data:{
        coach_id : options.id
      },
      success:function(res)
      {
        console.log(res)
        that.setData({
          photos:res.data.data
        })
      }
    })
  },
  imgYu: function (event) {
    console.log(event)
    var src = event.currentTarget.dataset.src;//获取data-src
    var imgList = this.data.photos;//获取data-list
    //图片预览
    wx.previewImage({
      current: src, // 当前显示图片的http链接
      urls: imgList // 需要预览的图片http链接列表
    })
  } 
})